package apis

import (
	"gluenet/pkg/gerrors"
	"gluenet/pkg/platform/glue"
	"gluenet/pkg/platform/helm"
)

func CreateInstanceFromConfig(config string, instanceName, guid, mod, typ string) (string, error) {
	switch mod {
	case ModuleDefault:
		switch typ {
		case KindApplication:
			return glue.CreateInstanceFromConfig(config, instanceName, guid)
		case KindStrategy:
			return glue.CreateInstanceFromConfig(config, instanceName, guid)
		default:
			return "", gerrors.UnknownTypeError
		}
	case ModuleHelm:
		return helm.CreateInstanceFromConfig(config, instanceName, guid)
	default:
		return "", gerrors.UnknownModuleError
	}
}
